﻿#ifndef DWGCIRCLEITEM_H
#define DWGCIRCLEITEM_H

#include "dwgobjectitem.h"

class DwgCircleItem : public DwgObjectItem
{
    Q_OBJECT
public:
    DwgCircleItem();
    DwgCircleItem(QPointF pt1,QPointF pt2);

    QPointF mCenPt;
    qreal mRad;

    void DrawSnapRect(QPainter *painter, QPointF cpt);

    int Snaped(QPointF spt);    // 设计一个捕捉特征点的函数，返回值为1-5分别代表捕捉到了哪个点
    // QGraphicsItem interface
public:
    virtual QRectF boundingRect() const override;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

    // DwgObjectItem interface
protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;

    // QGraphicsItem interface
public:
    virtual QPainterPath shape() const override;
};

#endif // DWGCIRCLEITEM_H
